import {HTTP} from '../util/http'

class Supply extends HTTP {
    category(params = {}, success) {
        let url = 'DataDictionary/querySupplierClassify'
        let data = Object.assign({},
            params,
            // {
            //     userId: wx.getStorageSync('userInfo').user_id || 0
            // }
        )
        this.request({
            url: url,
            data: data,
            success
        })
    }

    detail(params = {}, success) {
        let url = 'SupplierManagement/queryDetailById'
        let data = Object.assign({},
            params,
            // {
            //     userId: wx.getStorageSync('userInfo').user_id || 0
            // }
        )
        this.request({
            url: url,
            data: data,
            success
        })
    }

    supplyList(params = {}, success) {
        let url = 'SupplierManagement/querySupplierManagementPage'
        let data = Object.assign({
            count: 10
        },
            params,
            // {
            //     userId: wx.getStorageSync('userInfo').user_id || 0
            // }
        )
        this.request({
            url: url,
            method: 'POST',
            urlData: data,
            success
        })
    }

    publish(params = {}, success) {
        let url = 'SupplierManagement/save'
        let data = Object.assign({
            count: 10
        },
            params,
        )
        this.request({
            url: url,
            method: 'POST',
            data,
            success
        })
    }

    update(params = {}, success) {
        let url = 'SupplierManagement/updateById'
        let data = Object.assign({
            count: 10
        },
            params,
        )
        this.request({
            url: url,
            method: 'POST',
            data,
            success
        })
    }

    delete(params = {}, success) {
        let url = 'SupplierManagement/deleteById'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            urlData: data,
            success
        })
    }
}

export {Supply}